package com.quanyan.place.wrapper;

import com.quanyan.api.APIResponse;
import com.quanyan.club.entity.RespPlaceClubInfo;
import com.quanyan.common.Plugin.PageObj;
import com.quanyan.place.cache.PlaceRedisTemplate;
import com.quanyan.place.entity.PlaceBuyContractDetail;
import com.quanyan.place.entity.apireq.*;
import com.quanyan.place.entity.apiresp.RespPlaceClubActivity;
import com.quanyan.place.entity.apiresp.RespPlaceContractInfoExVo;
import com.quanyan.place.entity.apiresp.RespPlaceContractInfoVo;
import com.quanyan.place.entity.apiresp.RespPlaceInfo;
import com.quanyan.place.entity.vo.*;
import com.quanyan.place.entity.PlaceBuyContract;
import com.quanyan.platform.response.GatherPlaceResponse;
import com.quanyan.user.response.RespPlaceVideoInfo;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;

/**
 * Created by yangyun on 16-6-6.
 */
public interface PlaceWrapper {

    /**
     * 获取场馆列表
     * @param placeSearch
     * @return
     */
    PageObj<List<PlaceNewInfo>> getPlaceList(ReqPlaceSearch placeSearch);

    /**
     * 获取场馆签约地图数据
     * @param cityId
     * @param category
     * @param districtId
     * @param primeType
     * @param isSign
     * @return
     */
    PlaceDistribution getPlaceDistribuctionGroup(Integer cityId, Integer category, Integer districtId, Integer primeType, Integer isSign);

    /**
     * 获取场馆签约详情
     * @param placeId
     * @return
     */
    PlaceKpiInfo getPlaceSignDetailData(Integer placeId);

    /**
     * 获取场馆销售地图数据
     * @param cityId
     * @param category
     * @param districtId
     * @return
     */
    PlaceSaleDistribution getPlaceSaleDistribuctionGroup(Integer cityId, Integer category, Integer districtId);

    PageObj<List<PlaceInfo>> getCommercePlaceList(ReqPlaceSearch reqPlaceSearch);

    APIResponse saveOrUpdatePlace(PlaceFromDataVo placeFromDataVo);

    APIResponse updatePlaceData(PlaceFromDataVo placeFromDataVo);

    /**
     * 删除场馆
     * @param placeId
     * @return
     */
    APIResponse deletePlace(Integer placeId);

    /**
     * 删除场地
     * @param placeUnitId
     * @return
     */
    APIResponse deletePlaceUnit(Integer placeUnitId);

    APIResponse savePlaceUnitData(PlaceFromDataVo placeFromDataVo);

    /**
     * solr索引导入
     * @param map
     * @param solrUrl
     * @return
     */
    String importIndex(Map map, String solrUrl);

    /**
     * 更新场馆群id
     * @return
     */
    APIResponse updatePlaceGroupId(ReqPlaceInfo reqPlaceInfo);

    PageObj<List<RespPlaceContractInfoVo>> getContractList(ReqPlaceContractInfoVo reqVo);

    PageObj<List<RespPlaceContractInfoExVo>> getContractListEx(ReqPlaceContractInfoVo reqVo);

    RespPlaceContractInfoVo getContractDataById(Integer contractId);

    List<PlaceBuyContractDetail> getPlaceBuyContractDetailByPlaceUnitId(Integer placeUnitId, Integer attractId);

    PageObj<List<RespPlaceInfo>> getPlaceListByCategoryId(ReqPlaceSearch reqVo);

    APIResponse updatePlaceContratctInfo(ReqPlaceContractInfoVo reqVo);

    APIResponse deletePlaceContratctInfo(ReqPlaceContractInfoVo reqVo);

    APIResponse verifyContratctInfo(ReqPlaceContractInfoVo reqVo);

    APIResponse stopPlaceContratct(ReqPlaceContractInfoVo reqVo);

    List<RespPlaceContractInfoVo> expotrContractList(ReqPlaceContractInfoVo reqVo);

    boolean updateSolrIndex(Integer placeId);

    /**
     * 操作场馆上下架
     * @param placeId
     * @param status
     * @return
     */
    APIResponse isShelves(Integer placeId, Integer status);

    void delSolrSaleIndex(Integer placeId);

    void delSolrPlaceIndex(Integer placeId);

    String importIndexByTerm(Map map, String solrUrl);

    String importPlacesIndex(String placeIds);


    APIResponse<?> importIndex(Map map);

    /**
     * 同步场馆销售计划到sorl服务器
     * @param placeId
     * @return
     */
    APIResponse<?> syncPlaceSalePlanToSearchEngine(Integer placeId);

    void setPlaceIdToCache(Integer placeId, PlaceRedisTemplate placeRedisTemplate);

    void updateContractStatus();

    /**
     * 添加购进场馆场地合同信息
     * @param placeBuyContract
     * @return
     */
    APIResponse<?> addPlaceBuyContract(PlaceBuyContract placeBuyContract);

    boolean isExistsPlace(Integer placeId);

    /**
     * 获取合同支付列表
     * @param contractId
     * @return
     */
    APIResponse<?> getContractPayList(Integer contractId);


    /**
     * 插入或更新合同支付
     * @param reqVo
     * @return
     */
    APIResponse<?> updateContractPay(ReqContractPay reqVo);

    /**
     * 删除合同支付
     * @param reqVo
     * @return
     */
    APIResponse<?> deleteContractPay(ReqContractPay reqVo);

    /**
     * 插入推送场地预定短信相关的数据
     * @param reqPlaceMessageVo
     */
    APIResponse<?> insertMessageData(ReqPlaceMessageVo reqPlaceMessageVo);

    /**
     * 查询短信相关的数据
     * @param  placeId
     * @return
     */
    APIResponse<?> getMessageDataByPlaceId(Integer placeId);

    /**
     * 删除数据
     * @param reqPlaceMessageVo
     * @return
     */
    APIResponse<?> deleteMessageData(ReqPlaceMessageVo reqPlaceMessageVo);

    /**
     * 设置场馆运动项目最小销售单元
     * @param placeId
     * @param categoryId
     * @param timeUnit
     * @return
     */
    APIResponse setPlaceCategorySaleTimeUnit(Integer placeId, Integer categoryId, Byte timeUnit, Byte startSaleTimeType);

    List<RespPlaceClubInfo> selectClubByPlaceIds(Integer placeId, Integer number);

    List<RespPlaceClubInfo> selectActivityByPlaceIds(Integer placeId, Integer number);

    List<RespPlaceVideoInfo> getPlaceVideoInfo(Integer placeId, Integer number);

    RespPlaceClubActivity findPlaceVC(@NotNull Integer  placeId);

    List<GatherPlaceResponse> getMasterByPlaceId(Integer placeId, Integer pageNum, Integer pageSize);


    /**
     * 获取场馆单元销售计划详情、场馆是否有活动
     * @param reqPlaceSalePlan
     * @return
     */
    APIResponse<?> getPlaceSalePlan(ReqPlaceSalePlan reqPlaceSalePlan);
    
    /**
     * 获取场馆活动状态
     * @param placeId
     * @return
     */
    int  getPlaceActivityStatus(Integer placeId);
}
